#include "Pumping_system.h"
#include "Water_collection_system.h"
/*************************
 * 编译库
 * gcc -c Water_collection_system.c Pumping_system.c -lwiringPi -lpthread
 * ar rcs libpump.a *.o
 * cc -o 666 ceshi.c  -L ./ -lwiringPi -lpthread -lpump
************************/

void abc(WXT_MSG_ID a, int b, char c)
{

    printf("反馈== %d\n%d\n%c\n", a, b, c);
}
int main(void)
{

    int a = 0;
    a = raspberry_gpio_init_cb(abc);
    if (a == -1)
    {
        printf("树莓派引脚初始化失败,加 sudo 试试？\n");
        return -1;
    }
    else if (a == -2)
    {
        printf("线程创建错误\n");
        return -2;
    }
    else
    {
        printf("初始化成功\n");
    }

    int b = 0;
    while (1)
    {
        scanf("%d", &b);
        printf("%d\n", b);
        implement_pump_cmd(b);
        // printf("0==%d   ", pin_level_high_or_low(WATER_LEVEL_0));
        // printf("1==%d   ", pin_level_high_or_low(WATER_LEVEL_1));
        // printf("2==%d\n", pin_level_high_or_low(WATER_LEVEL_2));
        // printf("红外1==%d\n", pin_level_high_or_low(INFRARED_0));
        // printf("红外2==%d\n", pin_level_high_or_low(INFRARED_1));
        sleep(1);
    }
    return 0;
}
